home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 138
/
Volume 138 Aug 19 2011 - Damaged.iso
/
Games
/
mom_mania.swf
/
scripts
/
com
/
madewithscience
/
slint
/
FactoryClass.as
Wrap
Text File
|
2011-08-19
|
3KB
|
93 lines
package com.madewithscience.slint
{
import flash.display.DisplayObject;
import flash.display.Loader;
import flash.display.MovieClip;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.IOErrorEvent;
import flash.net.URLRequest;
import flash.utils.getDefinitionByName;
public class FactoryClass extends MovieClip
{
private var clip:MovieClip;
private var preloadOutput:MovieClip;
public function FactoryClass()
{
var _loc1_:Loader = null;
var _loc2_:URLRequest = null;
super();
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
addEventListener(Event.ENTER_FRAME,onFrame);
_loc1_ = new Loader();
_loc2_ = new URLRequest("Preloader.swf");
_loc1_.contentLoaderInfo.addEventListener(Event.COMPLETE,onAssetLoaded);
_loc1_.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR,onPreloadError);
_loc1_.load(_loc2_);
}
private function onPreloadError(param1:IOErrorEvent) : void
{
trace("error when trying to load preloader.swf");
}
private function init() : void
{
var _loc1_:Class = null;
var _loc2_:Object = null;
_loc1_ = Class(getDefinitionByName("MacAndCheeseMomMania"));
if(_loc1_)
{
_loc2_ = new _loc1_(this.stage);
addChild(_loc2_ as DisplayObject);
}
}
private function onAssetLoaded(param1:Event) : void
{
var _loc2_:Object = null;
if(framesLoaded != totalFrames)
{
preloadOutput = new MovieClip();
stage.addChild(preloadOutput);
_loc2_ = param1.target.applicationDomain.getDefinition("PreloadClip");
clip = new _loc2_();
preloadOutput.addChild(clip);
preloadOutput.x = 325;
preloadOutput.y = 200;
}
}
private function onFrame(param1:Event) : void
{
var _loc2_:Number = NaN;
if(framesLoaded == totalFrames)
{
removeEventListener(Event.ENTER_FRAME,onFrame);
if(preloadOutput != null)
{
stage.removeChild(preloadOutput);
}
nextFrame();
init();
}
else
{
_loc2_ = this.stage.loaderInfo.bytesLoaded / this.stage.loaderInfo.bytesTotal;
if(clip != null)
{
clip.bar.scaleX = _loc2_;
}
}
}
}
}